package net.htjs.mobile.qxoa.gw;

import java.io.IOException;
import java.util.concurrent.Callable;

import net.htjs.mobile.qxoa.util.L;
import net.htjs.mobile.qxoa.util.Util;

import org.apache.http.client.ClientProtocolException;
import org.json.JSONException;
import org.json.JSONObject;

public class Myinfodata {

	public String NewVersion=null;
	public String DownUrl=null;
	//public String NewVersion=null;
	
	public Myinfodata getmyinfodata(){
		final Myinfodata mid=new Myinfodata();
		
		
			new Thread(new Runnable(){

				@Override
				public void run() {
					try {
					// TODO Auto-generated method stub
					JSONObject jo=Util.getJOFromString(Util.getJsonFromUrl(L.appUpdateUrl	, ""));
					if(jo!=null){
						mid.DownUrl=jo.getString(L.APP.CDOWNLOADURL);
						mid.NewVersion=jo.getString(L.APP.CVERSION);
						}
					} catch (ClientProtocolException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (JSONException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}  
				}
				
			}).start();
			Object rtn=null;
			try {
				rtn = new Callable() {

					@Override
					public Object call() throws Exception {
						// TODO Auto-generated method stub
						Thread.sleep(10000l);
						return null;
					}
				}.call();
			} catch (Exception e2) {
				// TODO Auto-generated catch block
				e2.printStackTrace();
			}
			
			try {
				System.out.println(rtn);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			try {
				Thread.sleep(3500l);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}finally{
				return mid;
			}
			
		
	}
}
